package com.leetcode.merci.lc413;

import java.util.LinkedList;

/**
 * Created by bowen on 2017/7/26.
 */
public class Solution {
    public int numberOfArithmeticSlices(int[] A) {
        int max=0;
        int l=A.length;
        boolean[][] dp=new boolean[l][l];
        for(int i=0;i<l;i++){
            for(int j=i+2;j<l;j++){
                dp[i][j]=A[j]-A[i]==(j-i)*(A[j]-A[j-1]);
                if(dp[i][j]&&j>i+2){
                    dp[i][j]&=dp[i][j-1];
                }
                if(dp[i][j]){
                    max++;
                }
            }
        }
        return max;
    }

    public static void main(String[] args) {
        LinkedList<int[]> linkedList=new LinkedList<>();
    }
}